<#import "/spring.ftl" as spring/>
<#include "commonScript.ftl"/>
<script type="text/javascript">
    var formColumnSetting = [
        {
            index: "bizType",
            name: "bizType",
            type: "dropdown",
            data: [["进口", "I"], ["出口", "E"]],
            label: "业务类型"
        }, {
            index: "supId",
            name: "supId",
            label: "报关行",
            type:'dropdown',
            dropdownType: "ajax",
            keyWordName:'key',
            url: "<@spring.url '/order-dropdown/supCompanyByKey'/>",
            minLength: 0,
            success: function (data) {
                data = data.results;
                var array = [];
                $.each(data, function (i, n) {
                    array.push([n["name"], n["value"]]);
                });
                return array;
            }
            <#if isSup!false>
            ,hidden:true
            </#if>
        }, {
            index: "contactNo",
            name: "contactNo",
            label: "合同协议号"
        }, {
            index: "businessNo",
            name: "businessNo",
            label: "业务编码"
        }, {
            index: "contaNo",
            name: "contaNo",
            label: "集装箱号"
        }, {
            name: "company_co",
            label: "收发货人",
            type: "dropdown",
            dropdownType: "ajax",
            keyWordName:'key',
            url: "<@spring.url '/order-dropdown/company'/>",
            minLength: 0,
            success: function (data) {
                data = data.results;
                var array = [];
                $.each(data, function (i, n) {
                    array.push([n["text"], n["value"]]);
                });
                return array;
            }
        }, {
            index: "blNo",
            name: "blNo",
            label: "提运单号"
        }, {
            index: "custId",
            name: "custId",
            label: "实际委托人",
            type:'dropdown',
            dropdownType: "ajax",
            keyWordName:'key',
            url: "<@spring.url '/order-dropdown/cusCompanyByKey'/>",
            minLength: 0,
            success: function (data) {
                data = data.results;
                var array = [];
                $.each(data, function (i, n) {
                    array.push([n["name"], n["value"]]);
                });
                return array;
            }
            <#if isCust!false>,
            hidden : true
            </#if>
        },  {
            index: "sno",
            name: "sno",
            label: "报关单号"
        },  {
            index: "paymentTimeBegin",
            name: "paymentTimeBegin",
            label: "支付时间从",
            type:'date'
        },  {
            index: "paymentTimeEnd",
            name: "paymentTimeEnd",
            label: "支付时间至",
            type:'date'
        }

    ];

    var buttonSetting = [];

    var gridSetting = {
        id: "operationRecord",
            title: "业务跟踪管理",
            url: "<@spring.url "/business/declaOpRec/listPageData"/>",
        colModel: [{
            index: "ID",
            name: "ID",
            hidden: true
        }, {
            index: "DID",
            name: "DID",
            hidden: true
        }, {
            index: "BIZ_TYPE",
            name: "BIZ_TYPE",
            label:"业务类型",
            formatter:function(val){
                if(val){
                    return "E" === val?"出口":"进口"
                }
                return "";
            }
        }, {
            index: "CONTACT_NO",
            name: "CONTACT_NO",
            label: "合同协议号"
        }, {
            index: "BUSINESS_NO",
            name: "BUSINESS_NO",
            label: "业务编码"
        }, {
            index: "CONTANO",
            name: "CONTANO",
            label: "集装箱号",
            formatter:function(val, opts, row){
                if(val){
                    if(row.CONTA20+row.CONTA40 > 1)
                        return val + " 等";
                    else
                        return val;
                }
                return "";

            }
        }, {
            index: "FAHUO_COM_NAME",
            name: "FAHUO_COM_NAME",
            label: "收发货人"
        }, {
            index: "BL_NO",
            name: "BL_NO",
            label: "提运单号"
        }, {
            index: "CUSTOMER_COM_NAME",
            name: "CUSTOMER_COM_NAME",
            label: "实际委托人"
        }, {
            index: "SNO",
            name: "SNO",
            label: "报关单号"
        }, {
            index: "PAYMENT_TIME",
            name: "PAYMENT_TIME",
            label: "支付时间",
            formatter:function(val){
                return new Date(val).toLocaleString();
            }
        }, {
            index: "BIZ_STATUS",
            name: "BIZ_STATUS",
            label: "业务状态",
            formatter:function(val){
                switch (val) {
                    case "DS00":
                        return "草稿状态";
                    case "DS01":
                        return "已提交";
                    case "DS02":
                        return "已受理";
                    case "DS03":
                        return "驳回";
                    case "DS04":
                        return "已安排";
                    case "DS05":
                        return "放行";
                    case "DS06":
                        return "初审";
                    case "DS07":
                        return "复审";
                    case "DS08":
                        return "现场递单";
                    case "DS09":
                        return "查验";
                    case "DS10":
                        return "海关放行";
                    case "DS11":
                        return "商检放行";
                    case "DS13":
                        return "海关退单";
                    case "DS120":
                        return "查验中";
                    case "DS121":
                        return "查验完成";
                    case "DS122":
                        return "查验不通过";
                    case "DS124":
                        return "海关放行";
                    case "DS125":
                        return "商检放行";
                    case "DS126":
                        return "其他放行";
                    default:
                        return "";
                }
//                return opCodeTranslate(val);
            }
        }, {
            index: "DOC_STATUS",
            name: "DOC_STATUS",
            label: "单证发放状态"
        }],
        sortname: "PAYMENT_TIME",
        sortorder: "DESC",
        ondblClickRow: function (rowid, iRow, iCol, e) {
            location.href = "<@spring.url '/business/declaOpRec/viewPage'/>?did=" + $("#operationRecord").gridMethods().getSelectRow().DID
        }
    }
</script>

